package com.aizuda.boot.modules.business.performance.controller;


import com.aizuda.boot.modules.business.contract.dto.SingleResponse;
import com.aizuda.boot.modules.business.filling.domain.request.PageQuery;
import com.aizuda.boot.modules.business.performance.domain.request.SavePerformanceDTO;
import com.aizuda.boot.modules.business.performance.domain.request.UpdatePerformanceDTO;
import com.aizuda.boot.modules.business.performance.domain.response.PerformanceShowDTO;
import com.aizuda.boot.modules.business.performance.domain.response.PerformanceShowListDTO;
import com.aizuda.boot.modules.business.performance.service.ContractPerformanceService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author sangyirong
 * @ClassName PerformanceController
 * @Version 1.0
 * @Date 2025/6/4 15:40
 */
@Slf4j
@RestController
@Tag(name = "履约提醒管理接口")
@RequestMapping("/performance")
public class PerformanceController {

    @Autowired
    private ContractPerformanceService contractPerformanceService;

    @Operation(summary = "创建履约提醒")
    @PostMapping
    public SingleResponse<Void> createPerformance(@RequestBody SavePerformanceDTO dto) {
        return contractPerformanceService.createPerformance(dto);
    }

    @Operation(summary = "获取履约提醒")
    @GetMapping("/{id}")
    public SingleResponse<PerformanceShowDTO> getPerformance(@PathVariable Integer id) {
        return contractPerformanceService.getPerformance(id);
    }

    @Operation(summary = "更新履约提醒")
    @PutMapping
    public SingleResponse<Void> updatePerformance(@RequestBody UpdatePerformanceDTO dto) {
        return contractPerformanceService.updatePerformance(dto);
    }

    @Operation(summary = "删除履约提醒")
    @DeleteMapping("/{id}")
    public SingleResponse<Void> deletePerformance(@PathVariable Integer id) {
        return contractPerformanceService.deletePerformance(id);
    }

    @Operation(summary = "获取履约提醒列表")
    @PostMapping("/list")
    public SingleResponse<IPage<PerformanceShowListDTO>> getPerformanceList(@RequestBody PageQuery pageQuery) {
        return contractPerformanceService.getPerformanceList(pageQuery);
    }
} 